<<<<<<< .mine
Chlievik.prototype = new Sprite();
Chlievik.tFormat = new TextFormat("Consolas",25,black);
Chlievik.tFormat.align = TextFormatAlign.CENTER;
function Chlievik (val,posx,posy,width,path){
    Sprite.apply(this);
    //this.bg = new Sprite();
    this.buttonMode = true;
    this.mouseChildren = false;
    this.val = val;
    this.x = posx-(width/2);
    this.y = posy-(width/2);
    this.SetWidth (width);
    this.SetHeight (width);
    this.width = width;
    this.height = width;
                
    this.isClicked = false;          
    this.bitmap = Game._game.bitmaps[path+"sortButton.png"];
    this.bitmapClick = Game._game.bitmaps[path+"sortButtonClicked.png"];
    this.addChild(this.bitmap);
      
    this.changeState = changeState;
    this.setClicked = setClicked;
    this.setUnClicked = setUnClicked;
                
                
    this.textArea = new TextField();
    if (val == null){
        this.textArea.text = "";
    }
    else{
        this.textArea.text = val;
    }
    this.textArea.setTextFormat(Chlievik.tFormat);
    this.textArea.width = this.textArea.height = this.width;
    this.addChild(this.textArea);
    var tHeight = this.textArea.textHeight;
    this.textArea.y = (this.width-tHeight)/2;
                
    this.updateText = updateText;  
               
      
    function updateText(){
        if (this.val == null){
            this.textArea.text = "";
        }
        else{
            this.textArea.text = this.val;
        }
    }


    function setClicked(){
        if (!this.isClicked){
            this.isClicked = true;
            this.removeChild(this.bitmap);
            this.addChildAt(this.bitmapClick,0);
        }
    }

    function setUnClicked(){
        if (this.isClicked){
            this.isClicked = false;
            this.removeChild(this.bitmapClick);
            this.addChildAt(this.bitmap,0);
        }
    }

    function changeState(){
        this.isClicked = !this.isClicked;
        this.bitmapClick.visible = this.isClicked;
        this.bitmap.visible = !this.isClicked;
        console.debug("change state");
    }

}
     

=======
Chlievik.prototype = new Sprite();
Chlievik.tFormat = new TextFormat(font,25,0x000000);
Chlievik.tFormat.align = TextFormatAlign.CENTER;
/**
*@class Chlievik
*@augments Sprite 
*@param val hodnota uschovana v chlieviku
*@param posx  pozicia x
*@param posy  pozicia y
*@param width sirka resp. vyska chlieviku
*@description Trieda pre chlievik v ktorom je uschovane cislo
*/
function Chlievik (val,posx,posy,width){
                Sprite.apply(this);
                //this.bg = new Sprite();
                this.buttonMode = true;
                this.mouseChildren = false;
                this.val = val;
                this.x = posx-(width/2);
                this.y = posy-(width/2);
                this.SetWidth (width);
                this.SetHeight (width);
                this.width = width;
                this.normalColor = 0x606060;
                this.eventColor = 0xffffff;
                this.currColor = this.normalColor;
                this.textArea = new TextField();
                if (val == null){
                    this.textArea.text = "";
                }
                else{
                    this.textArea.text = val;
                }
                this.textArea.setTextFormat(Chlievik.tFormat);
                this.textArea.width = this.textArea.height = this.width;
                this.addChild(this.textArea);
                var tHeight = this.textArea.textHeight;
                this.textArea.y = (this.width-tHeight)/2;
                
                this.draw = draw;
                this.updateText = updateText;  
                this.draw();
                
}
/**
 * @class Chlievik
 * @description Metoda opravujuca label pri zmene hodnoty chlieviku
 */
function updateText(){
    if (this.val == null){
        this.textArea.text = "";
    }
    else{
        this.textArea.text = this.val;
    }
}

/**
 * @class Chlievuk
 * @description Metoda vykreslujuca chlievik
 */
function draw(){
    this.graphics.beginFill(this.currColor);
    this.graphics.drawRect(0,0,this.width,this.width);
    this.graphics.endFill();
}

     

>>>>>>> .r36
